<template>
  <!--延期-->
  <div>
    <mu-expansion-panel  v-if="delayApprovalVo" class="noshadow" :expand="false">
      <div slot="header" class="noshadow_tit">
        <!--{{this.checkRectId}}-->
        <!--{{'123'}}-->
        <div><span class="noshadow_tit_con">延期处理申请人：</span><span class="noshadow_tit_name">{{ delayApprovalVo.applyUserName||'---'}}</span></div>
        <div><span class="noshadow_tit_con">申请时间：</span><span class="noshadow_tit_name">{{ delayApprovalVo.applyTime || '---'}}</span></div>
      </div>
      <section class="box">
        <p class="line-list textdot">
          原始整改期限：<span class="line-list-con">{{ delayApprovalVo.beforeEndTime}}</span>
        </p>
        <p class="line-list textdot">
          延期整改期限：<span class="line-list-con">{{ delayApprovalVo.afterEndTime}}</span>
        </p>
        <p class="line-list textdot">
          备注：<span class="line-list-con">{{ delayApprovalVo.remark}}</span>
        </p>
      </section>
      <!-- <div class="lan-card-footer">
        <div class="lan-btn big danger" @click="agrreOrNO(delayApprovalVo,'1')" >
            拒绝
        </div>
        <div class="lan-btn big default" @click="agrreOrNO(delayApprovalVo,'0')">
            同意
        </div>
      </div> -->
    </mu-expansion-panel>
  </div>
</template>

<script>
import { MessageBox } from "mint-ui";
  export default {
    name: "delay",
    props:{//
      delayApprovalVo:{
        type:Object,
        default: function () {
          return ""
        }
      },
       checkRectId:{
        type:String,
        default: function () {
          return ""
        }
      }
    },
    methods: {
       //同意拒绝
      agrreOrNO(item,flag){
        let _this = this;
        MessageBox({
          title: '审批提示',
          message: `确认${flag==1?'拒绝':'同意'}此任务？`,
          confirmButtonText: '同意',
          showCancelButton:true,

        }).then(action => {
          console.log(action)
          if(action == 'confirm'){
            _this.postApproval(item, flag)
          }
        });
      },
      postApproval(list, flag){
        let obj = {
          id:this.$route.query.id,
          businessId: this.checkRectId,
          applyType: '0',//0延期，1问题闭合
          flag: flag,
          endTime:new Date(new Date().getTime()+8*60*60*1000).toISOString().replace('T',' ').substr(0,19)
        }
        this.$openLoading();
        this.$A.Go('post','/safety/approval/submit',obj).then(success=>{
            if(success.code == 200){
              this.$A.MS('审批成功')
              // this.$emit('refresh')
              this.$router.back()
            } else {
              this.$A.MS(success.msg)
            }
            this.$closeLoading();
          },
          function(err) {
            console.warn(err);
          }
        );
      }
    }
  }
</script>

<style scoped lang="scss">
  @import "assign.scss";
</style>
